package com.easyskool.services.core;

import java.io.Serializable;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.codehaus.jackson.map.ObjectMapper;

import com.easyskool.composer.WebadminComposer;
import com.easyskool.constants.CommonConstants;
import com.easyskool.constants.MessageConstants;
import com.easyskool.exception.ComposerException;
import com.easyskool.utilfunction.NullObjects;
import com.easyskool.utilfunction.UtilFunctions;
import com.ivp.cloud.stratus.logger.LoggingUtil;
import com.sun.jersey.spi.container.servlet.PerSession;

@SuppressWarnings("serial")
@Path("/master")
@PerSession
public class WebadminService implements Serializable{
	
		WebadminComposer composer = new WebadminComposer();
		private static LoggingUtil 	logger 	= 	(LoggingUtil)LoggingUtil.getLogger(WebadminService.class.getName());
		
		
		@Path("/insertfollowUpDetails") 
		@POST
		@Produces("application/json")
		public Response insertfollowUpDetails(  String dataString,	@Context HttpServletRequest req )
								throws Exception{			
			try {
				HttpSession  session = req.getSession(false);
				System.out.println("Data entering insertfollowupdetails service "+dataString);
				composer.insertfollowUpDetails((String)session.getAttribute("userCode"),dataString);
			}
			catch(ComposerException e) {
				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ALREADY_EXISTS)).build();
			} catch(Exception e) {
				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ERROR)).build();
			}
			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE,MessageConstants.SUCCESS)).build();
		}

//		
//		@Path("/insertMasterSection") 
//		@POST
//		@Produces("application/json")
//		public Response insertMasterSection(@QueryParam("user") String user,
//								   @QueryParam("fields") String insertValues)
//								throws Exception{			
//			try {
//				composer.createMasterSection(user, insertValues);
//			}
//			catch(ComposerException e) {
//				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ALREADY_EXISTS)).build();
//			} catch(Exception e) {
//				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE,MessageConstants.SUCCESS)).build();
//		}
//
//		
//		@Path("/getMasterSection") 
//		@POST
//		@Produces("application/json")
//		public Response getMasterSection(@QueryParam("user") String user,
//								   @QueryParam("whereClause") String whereClause)
//								throws Exception{
//			String result = null;
//			
//			try {
//			result = composer.getMasterSection(user, whereClause);
//			
//			System.out.println("result : "+result);
//			} catch(ComposerException e) {
//				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.GET, MessageConstants.ALREADY_EXISTS)).build();
//			} catch(Exception e) {
//				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.GET, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(result).build();
//		}
//		
//		@Path("/updateMasterSection") 
//		@POST
//		@Produces("application/json")
//		public Response updateMasterSection(@QueryParam("user") String user,
//										  @QueryParam("whereClause") String whereClause,
//										  @QueryParam("updateClause") String updateClause)
//								throws Exception{
//			try {
//				composer.updateMasterSection(user, whereClause , updateClause);
//			} catch(ComposerException e) {
//					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE, MessageConstants.ALREADY_EXISTS)).build();
//			} catch(Exception e) {
//					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE,
//					MessageConstants.SUCCESS)).build();
//		}
//		
//		@Path("/deleteMasterSection") 
//		@POST
//		@Produces("application/json")
//		public Response deleteMasterSection(@QueryParam("user") String user,
//										  @QueryParam("whereClause") String whereClause)
//								throws Exception{
//			try {
//				composer.deleteMasterSection(user, whereClause);
//			} catch(ComposerException e) {
//					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			} catch(Exception e) {
//					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE,
//					MessageConstants.SUCCESS)).build();
//		}
//		
//		@Path("/deleteSelectedMasterSection") 
//		@POST
//		@Produces("application/json")
//		public Response deleteSelectedMasterSection(@QueryParam("user") String user,
//										  @QueryParam("whereClause") String whereClause)
//								throws Exception{
//			try {
//				composer.deleteSelectedMasterSection(user, whereClause);
//			} catch(ComposerException e) {
//					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			} catch(Exception e) {
//					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE,
//					MessageConstants.SUCCESS)).build();
//		}
//		
		@Path("/insertMasterClass") 
		@POST
		@Consumes(MediaType.APPLICATION_JSON)
		public Response insertMasterClass(String jsonData,@Context HttpServletRequest req)
//				@QueryParam("user") String user,
//								   @QueryParam("fields") String insertValues)
								throws Exception{			
			try {
				HttpSession session = req.getSession(true);
				String user = (String) session.getAttribute(CommonConstants.USERCODE);
				ObjectMapper mapper = new ObjectMapper();
				System.out.println("json data : "+ jsonData);
				Map whereMap = mapper.readValue(jsonData, Map.class);
				Map insertValues =  (Map) whereMap.get(CommonConstants.FIELD);
				String insertString = mapper.writeValueAsString(insertValues);
				System.out.println("insert values : "+insertValues);
				
				
				System.out.println("insert values"); 
				composer.createMasterClass(user,insertString);
			}
			catch(ComposerException e) {
				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ALREADY_EXISTS)).build();
			} catch(Exception e) {
				e.printStackTrace();
				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ERROR)).build();
			}
			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE,MessageConstants.SUCCESS)).build();
		}

		
		@Path("/getMasterClass") 
		@POST
		@Consumes(MediaType.APPLICATION_JSON)
		public Response getMasterClass
		(String jsonData,@Context HttpServletRequest req)
				throws Exception{
		HttpSession session = req.getSession(true);	
//				@QueryParam("user") String user,
//								   @QueryParam("whereClause") String whereClause)
			String result = null;
			
			try {
				ObjectMapper mapper = new ObjectMapper();
				Map whereMap = mapper.readValue(jsonData, Map.class);
				String whereClause = (String) whereMap.get(CommonConstants.WHERE_CLAUSE);
				System.out.println("where map : "+whereMap);
				System.out.println("where  : "+jsonData);
				result = composer.getMasterClass(whereClause);
			
			System.out.println("result : "+result);
			} catch(ComposerException e) {
				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.GET, MessageConstants.ALREADY_EXISTS)).build();
			} catch(Exception e) {
				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.GET, MessageConstants.ERROR)).build();
			}
			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(result).build();
		}
		

		
		@Path("/updateMasterClass") 
		@POST
		@Produces("application/json")
		public Response updateMasterClass(String jsonData)
								throws Exception{
			try {
				ObjectMapper mapper = new ObjectMapper();
				String whereString = null;
				String updateString  = null;
				System.out.println("json data : "+jsonData);
				Map jsonMap = mapper.readValue(jsonData, Map.class);
				Map updateClause = (Map) jsonMap.get(CommonConstants.UPDATE_CLAUSE);
				Map whereClause = (Map) jsonMap.get(CommonConstants.WHERE_CLAUSE);
				if(!NullObjects.isNull(whereClause)){
					 whereString = mapper.writeValueAsString(whereClause);
				}
				if(!NullObjects.isNull(updateClause)){
					 updateString = mapper.writeValueAsString(updateClause);
				}
				composer.updateMasterClass(whereString , updateString);
			} catch(ComposerException e) {
				e.printStackTrace();
					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE, MessageConstants.ALREADY_EXISTS)).build();
			} catch(Exception e) {
				e.printStackTrace();
					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE, MessageConstants.ERROR)).build();
			}
			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE,
					MessageConstants.SUCCESS)).build();
		}
		
		@Path("/deleteMasterClass") 
		@POST
		@Produces("application/json")
		public Response deleteMasterClass(@QueryParam("user") String user,
										  @QueryParam("whereClause") String whereClause)
								throws Exception{
			try {
				composer.deleteMasterClass(user, whereClause);
			} catch(ComposerException e) {
					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
			} catch(Exception e) {
					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
			}
			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE,
					MessageConstants.SUCCESS)).build();
		}
		
		@Path("/deleteSelectedMasterClass") 
		@POST
		@Produces("application/json")
		public Response deleteSelectedMasterClass(@QueryParam("user") String user,
										  @QueryParam("whereClause") String whereClause)
								throws Exception{
			try {
				composer.deleteSelectedMasterClass(user, whereClause);
			} catch(ComposerException e) {
					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
			} catch(Exception e) {
					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
			}
			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE,
					MessageConstants.SUCCESS)).build();
		}
//		
//		@Path("/insertMasterSubject") 
//		@POST
//		@Produces("application/json")
//		public Response insertMasterSubject(@QueryParam("user") String user,
//								   @QueryParam("fields") String insertValues)
//								throws Exception{			
//			try {
//				composer.createMasterSubject(user, insertValues);
//			}
//			catch(ComposerException e) {
//				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ALREADY_EXISTS)).build();
//			} catch(Exception e) {
//				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.CREATE,MessageConstants.SUCCESS)).build();
//		}
//
//		
//		@Path("/getMasterSubject") 
//		@POST
//		@Produces("application/json")
//		public Response getMasterSubject(@QueryParam("user") String user,
//								   @QueryParam("whereClause") String whereClause)
//								throws Exception{
//			String result = null;
//			
//			try {
//			result = composer.getMasterSubject(user, whereClause);
//			
//			System.out.println("result : "+result);
//			} catch(ComposerException e) {
//				logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.GET, MessageConstants.ALREADY_EXISTS)).build();
//			} catch(Exception e) {
//				logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//				return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.GET, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(result).build();
//		}
//		
//		@Path("/updateMasterSubject") 
//		@POST
//		@Produces("application/json")
//		public Response updateMasterSubject(@QueryParam("user") String user,
//										  @QueryParam("whereClause") String whereClause,
//										  @QueryParam("updateClause") String updateClause)
//								throws Exception{
//			try {
//				composer.updateMasterSubject(user, whereClause , updateClause);
//			} catch(ComposerException e) {
//					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE, MessageConstants.ALREADY_EXISTS)).build();
//			} catch(Exception e) {
//					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.UPDATE,
//					MessageConstants.SUCCESS)).build();
//		}
//		
//		@Path("/deleteMasterSubject") 
//		@POST
//		@Produces("application/json")
//		public Response deleteMasterSubject(@QueryParam("user") String user,
//										  @QueryParam("whereClause") String whereClause)
//								throws Exception{
//			try {
//				composer.deleteMasterSubject(user, whereClause);
//			} catch(ComposerException e) {
//					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			} catch(Exception e) {
//					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE,
//					MessageConstants.SUCCESS)).build();
//		}
//		
//		@Path("/deleteSelectedMasterSubject") 
//		@POST
//		@Produces("application/json")
//		public Response deleteSelectedMasterSubject(@QueryParam("user") String user,
//										  @QueryParam("whereClause") String whereClause)
//								throws Exception{
//			try {
//				System.out.println("whereClause : "+whereClause);
//				composer.deleteSelectedMasterSubject(user, whereClause);
//			} catch(ComposerException e) {
//					logger.error(e.getErrorMsg() + ":" + e.toString() + ":" + e.getErrorMsg() + ":" + e.getExthr() + ":" + e.getExthr().getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			} catch(Exception e) {
//					logger.error(e.toString() + ":" + e.getMessage() + ":" + e.getCause());
//					return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE, MessageConstants.ERROR)).build();
//			}
//			return Response.status(MessageConstants.STATUS_ACCEPTED).entity(UtilFunctions.createJsonObject(MessageConstants.DELETE,
//					MessageConstants.SUCCESS)).build();
//		}
//				
//
//	/**
//		 * rejects the school requests
//		 * @param user name of the user 
//		 * @param whereClause gets null
//		 * @return
//		 * @throws Exception
//		 */
//		@Path("/acceptSchoolRequest")
//		@POST
//		@Produces("application/json")
//		public Response acceptSchoolRequest(@QueryParam("user") String user,
//				@QueryParam("whereClause") String whereClause,
//				@Context HttpServletRequest req) throws Exception {
//			String result = null;
//			JsonObject json = new JsonObject();
//			try{
//
//			user=UtilFunctions.getUserName(req);
//			System.out.println("AccEPT : " + whereClause+" USER "+user);
//			result = composer.acceptSchoolRequest(user, whereClause);
//			if(CommonConstants.SUCCESS.equals(result))
//			{ 
//				json.addProperty(CommonConstants.UPDATE, CommonConstants.SUCCESS) ;
//				return Response.status(200).entity(json.toString()).build(); 
//			}
//			else
//			{
//				 json.addProperty(CommonConstants.UPDATE, CommonConstants.FAIL) ;
//				 return Response.status(200).entity(json.toString()).build();
//			}
//			}
//			catch(Exception e)
//			{
//				json.addProperty(CommonConstants.UPDATE, CommonConstants.FAIL) ;
//				return Response.status(200).entity(json.toString()).build();
//			}
// 		}
//		/**
//		 * rejects the school requests
//		 * @param user name of the user 
//		 * @param whereClause gets null
//		 * @return
//		 * @throws Exception
//		 */
//		@Path("/rejectSchoolRequest")
//		@POST
//		@Produces("application/json")
//		public Response rejectSchoolRequest(@QueryParam("user") String user,
//				@QueryParam("whereClause") String whereClause ,
//				@Context HttpServletRequest req) throws Exception {
//			JsonObject json = new JsonObject();
//			try{
//			String result = null;
//			user=UtilFunctions.getUserName(req);
//			System.out.println("result " + whereClause+" USER "+user);
//			result = composer.rejectSchoolRequest(user, whereClause);
//			if(CommonConstants.SUCCESS.equals(result))
//			{ 
//				json.addProperty(CommonConstants.UPDATE, CommonConstants.SUCCESS) ;
//				return Response.status(200).entity(json.toString()).build(); 
//			}
//			else
//			{
//				 json.addProperty(CommonConstants.UPDATE, CommonConstants.FAIL) ;
//				 return Response.status(200).entity(json.toString()).build();
//			}
//			}
//			catch(Exception e)
//			{
//				json.addProperty(CommonConstants.UPDATE, CommonConstants.FAIL) ;
//				return Response.status(200).entity(json.toString()).build();
//			}
//		}
//		/**
//		 * gets the data of requests which have neither been rejected nor accepted
//		 * @param user
//		 * @param whereClause
//		 * @return
//		 * @throws Exception
//		 */
//		@Path("/getSchoolRequests")
//		@POST
//		@Produces("application/json")
//		public Response getSchoolRequests(@QueryParam("user") String user,
//				@QueryParam("whereClause") String whereClause,
//				@Context HttpServletRequest req) throws Exception {
//			String result = null;
//			user=UtilFunctions.getUserName(req);
//			result = composer.getSchoolRequests(user, whereClause);
//			System.out.println("result : " + result);
//			return Response.status(200).entity(result).build();
//		}
//
//	
}
